<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /** 类数组对象必须要有length属性,没有length属性 返回 [],且元素属性名必须是数值或者可转换为数值的字符 
         *  Array.from
         * 
         */
        const classArrat1 = { 0: '1', 1: '2', length: 5 }

        console.log(Array.from(classArrat1), 'classArrat1'); //length 和数值 1 2
        /* ************************************************************** */
        const classArray2 = { 0: '1', 1: '2' } //添加一个没有 length 属性
        console.log(Array.from(classArray2), 'classArray2'); //[]
    </script>
</body>

</html>